﻿#region Using Statments

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime;
using System.Runtime.InteropServices;
using System.Text;

#endregion

#region Disclaimer

/*
    Copyright (c) <2010>, Michael T. Joiner
    All rights reserved.

    Redistribution and use in source and binary forms, with or without modification, 
    are permitted provided that the following conditions are met:
   
    Redistributions of source code must retain the above copyright notice, this list 
    of conditions and the following disclaimer.
    
    Redistributions in binary form must reproduce the above copyright notice, this list 
    of conditions and the following disclaimer in the documentation and/or other materials 
    provided with the distribution.
    
    Neither the name of the Copyright holder nor the names of its contributors 
    may be used to endorse or promote products derived from this software without 
    specific prior written permission.
    
    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
    ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
    OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 
    THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
    OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE..
 
 */

#endregion

#region File Description
/*
    /////////////////////////////////////////////////////////////////////////////////////////
    
                                  <Struct FILE> DESCRIPTION
                                -----------------------------
    [Enter File Description Info Here]
    
    /////////////////////////////////////////////////////////////////////////////////////////
*/
#endregion

namespace SlimGame.Framework.Graphics
{
    [Serializable()]
    [StructLayout(LayoutKind.Sequential)]
    public struct Vector3
    {
        #region Fields

        private float _X;
        private float _Y;
        private float _Z;

        #endregion

        #region Properties
        
        /// <summary>
        /// Value of a point on the X Plane
        /// </summary>
        public float X
        {
            get { return _X; }
            set { _X = value; }
        }

        /// <summary>
        /// Value of a point on the Y Plane
        /// </summary>
        public float Y
        {
            get { return _Y; }
            set { _Y = value; }
        }

        /// <summary>
        /// Value of a point on the Z Plane
        /// </summary>
        public float Z
        {
            get { return _Z; }
            set { _Z = value; }
        }

        #region Static Properties

        /// <summary>
        /// Gets a One Vector3
        /// </summary>
        public static Vector3 One
        {
            get { return new Vector3(1.0f, 1.0f, 1.0f); }
        }

        /// <summary>
        /// Gets a One Vector3
        /// </summary>
        public static Vector3 Zero
        {
            get { return new Vector3(0.0f, 0.0f, 0.0f); }
        }

        /// <summary>
        /// Gets Vector3 pointing in the Up Direction
        /// </summary>
        public static Vector3 Up
        {
            get { return new Vector3(0.0f, 0.0f, 1.0f); }
        }

        /// <summary>
        /// Gets Vector3 pointing in the Down Direction
        /// </summary>
        public static Vector3 Down
        {
            get { return new Vector3(0.0f, 0.0f, -1.0f); }
        }

        /// <summary>
        /// Gets Vector3 pointing in the Left Direction
        /// </summary>
        public static Vector3 Left
        {
            get { return new Vector3(-1.0f, 0.0f, 0.0f); }
        }

        /// <summary>
        /// Gets Vector3 pointing in the Right Direction
        /// </summary>
        public static Vector3 Right
        {
            get { return new Vector3(1.0f, 0.0f, 0.0f); }
        }

        /// <summary>
        /// Gets Vector3 pointing in the Forward Direction
        /// </summary>
        public static Vector3 Forward
        {
            get { return new Vector3(0.0f, 1.0f, 0.0f); }
        }

        /// <summary>
        /// Gets Vector3 pointing in the Backwards Direction
        /// </summary>
        public static Vector3 Backwards
        {
            get { return new Vector3(0.0f, -1.0f, 0.0f); }
        }
        
        #endregion

        #endregion

        /// <summary>
        /// Defines a 3D Vector in Space
        /// </summary>
        /// <param name="x">Value of a point on the X Plane</param>
        /// <param name="y">Value of a point on the Y Plane</param>
        /// <param name="z">Value of a point on the Z Plane</param>
        public Vector3(float x, float y, float z) 
        {
            this._X = x;
            this._Y = y;
            this._Z = z;
        }

        /// <TODO> Add Support for Finding Lenths, operators for Adding, Subtracting, Dividing, Multipling, Equals, !=
    }
}
